package com.ext.aic.apis.content;

import android.content.Context;

import androidx.lifecycle.LifecycleOwner;

import com.ext.aic.apis.ApiDefine;
import com.ext.aic.apis.ApiPaths;
import com.ext.aic.apis.RequestResponse;
import com.ext.aic.beans.params.ContentPublishParams;
import com.ext.aic.beans.response.ContentPublishResponse;
import com.eyinfo.android_pure_utils.utils.JsonUtils;
import com.hjq.http.EasyHttp;
import com.hjq.http.body.JsonRequestBody;

public class ContentPublishRequest {

    protected void onContentPublishSuccess(ContentPublishResponse result) {

    }

    public void request(Context context, LifecycleOwner lifecycleOwner, ContentPublishParams params, boolean isShowLoading) {
        EasyHttp.post(lifecycleOwner)
                .api(new ApiDefine(ApiPaths.contentPublish))
                .body(new JsonRequestBody(JsonUtils.toJson(params)))
                .request(new RequestResponse<ContentPublishResponse>(context, isShowLoading) {
                    @Override
                    protected void onSuccess(ContentPublishResponse response) {
                        onContentPublishSuccess(response);
                    }
                });
    }
}
